function res = err(u1,u2,p,x_max)
if p == -1
    res = norm(u1-u2,Inf);
elseif p >= 1
    N = size(u1,2)-1;
    h = x_max/N;
    res = norm(u1-u2,p)*h^(1/p);
end
